package com.four.bergain.controller;


import com.four.bergain.service.IBargainUserService;
import com.guli.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author gs
 * @since 2021-12-20
 */
@RestController
@RequestMapping("/bargain-user")
public class BargainUserController {

    @Autowired
    private IBargainUserService bargainUserService;

    /**
     * 开始砍价
     * @param baId
     * @param userId
     * @return
     */
    @GetMapping("savePeople/{baId}/{userId}")
    public R savePeople(@PathVariable("baId") Integer baId, @PathVariable("userId")Integer userId) {

        return bargainUserService.savePeople(baId,userId);
    }

    /**
     * 提取让别人帮砍价路径
     * @param baId
     * @param userId
     * @return
     */
    @GetMapping("share/{baId}/{userId}")
    public R  share(@PathVariable("baId") Integer baId, @PathVariable("userId")Integer userId) {

        return bargainUserService.share(baId,userId);
    }


}
